package com.example.libo.huihui.application;

import android.app.Application;
import com.example.libo.huihui.config.Urls;
import com.example.libo.huihui.utils.HttpService;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by libo on 2017/1/10.
 */

public class MyApplication extends Application{
    private static HttpService httpService;

    public static HttpService getHttpService(){
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Urls.BASEURL)
                .addConverterFactory(GsonConverterFactory.create())   //json数据转换工厂
                .build();
        if(httpService == null){
            httpService = retrofit.create(HttpService.class);
        }
        return httpService;
    }
}
